<?php
/**
 * Created by PhpStorm.
 * User: heitao
 * Date: 2018/5/14
 * Time: 20:31
 */

namespace app\api\controller;

use manniu\controller\Base;

class QRCode extends Base
{
    /**
     * tp5初始化方法
     */
    public function _initialize() {
        parent::_initialize();
        if(!$this->uid && !$this->aid){
            exit();
        }
    }

    /**
     * 二维码
     * @access public
     * @return \think\Response
     */
    public function qrCode($data = ''){
        if($data){
            $qrCode = new \Endroid\QrCode\QrCode();
            $qrCode->setText(urldecode($data))->setSize(200);
            $qrCode->render();
        }
    }
}